<template>
  <!--<div/>-->
  <div class="act-form" style="height: 100%; width: 100%;overflow: hidden">
    <iframe id="bdIframe" :src="src" style="width:100%;height:100%;border:none"/>
  </div>
</template>

<script>
export default {
  data() {
    return {
      // urls: ['index.html', 'area.html', 'smart/index.html', 'smart/site.html', 'site.html', 'indoor/index.html', 'smart/index.html'],
      urls: [
        'outdoor/province.html', 'outdoor/city.html', 'outdoor/area.html', 'outdoor/site.html',
        'indoor/province.html', 'indoor/city.html', 'indoor/area.html', 'indoor/site.html',
        'smart/province.html', 'smart/city.html', 'smart/area.html', 'smart/site.html',
        'reduced/index.html','smart/site1.html','smart/area1.html','smart/city1.html',
        'smart/province1.html','smartTest/site.html','smart3D/site1.html','smart2D/site1.html',
        'laboratory/province.html','laboratory/city.html','laboratory/area.html','laboratory/site.html',
        'laboratory/floor.html','laboratory/room.html','laboratory/site2.html','laboratory/site3.html'
        ,'laboratory/setDemo.html','smart3D/province1.html','smart3D/city1.html','smart3D/area1.html',
        'BigAri5/province.html','BigAri5/city.html','BigAri5/area.html','BigAri5/site.html',
        'smartLYF/province.html','smartLYF/city.html','smartLYF/area.html','smartLYF/site.html',
        'smartJT/province.html','smartJT/city.html','smartJT/area.html','smartJT/site.html',
        'smartJT/floor.html','smartJT/room.html','','',
        'airDog/site.html','airDog/indoor.html','airDog/point.html','',
        'dangerSmart/site1.html','','','',
        'smartServer2D/site1.html','','','',
        'smartServer3D/site1.html','','',''
      ],
      src: ''
    }
  },
  created: function() {
    const id = parseInt(this.getRequest().id)
    console.log('uuuuu id=' + id)
    this.src = '/air/' + this.urls[id] + '?userId=' + this.$store.state.user.id + '&id=' + this.$store.state.user.fsiteNo + '&name=' + this.$store.state.user.fsiteName + '&tenantNo=' + this.$store.state.user.tenantNo + '&token=' + this.$store.state.user.token.substr(this.$store.state.user.token.lastIndexOf(" ") + 1)
    // 'http://localhost:' + this.getUrlPort(this.$store.state.user.bigScreenUrl)
  },
  methods: {
    getRequest: function() {
      var url = location.href
      var request = {}
      var idx = url.indexOf('?')
      if (idx !== -1) {
        var str = url.substr(idx + 1)
        var strs = str.split('&')
        for (var i = 0; i < strs.length; i++) {
          request[strs[i].split('=')[0]] = decodeURIComponent(strs[i].split('=')[1])
        }
      }
      return request
    },
    getUrlPort: function(bigScreenUrl) {
      var strs = bigScreenUrl.split(':')
      if (strs.length === 3) {
        return strs[2]
      }
    }
  }
}
</script>
